package com.pingan.glue.gluegame.exception;

import com.pingan.glue.gluegame.common.ErrorMessage;

public class BusinessException extends RuntimeException {

    private String code;
    private String message;

    public BusinessException(String code, String message, Throwable e) {
        super(message,e);
        this.code = code;
        this.message = message;
    }

    public BusinessException(String code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public BusinessException(ErrorMessage error, Throwable e) {
        super(error.getMessage(),e);
        this.code = error.getCode();
        this.message = error.getMessage();
    }
    public BusinessException(ErrorMessage error) {
        super(error.getMessage());
        this.code = error.getCode();
        this.message = error.getMessage();
    }

    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
